from selenium.webdriver.common.by import By

from base import Base
class Page(Base):
    #第一步
    def sou(self):
        print('点击搜索框')
        loc = (By.ANDROID_UIAUTOMATOR,'new UiSelector().text("搜商品名称 作者 出版社 ISBN")')
        ele = self.find_ele(loc)
        return ele
    # 第二步
    def shu(self):
        print('输入搜索内容')
        loc = (By.CLASS_NAME,'android.widget.EditText')
        ele = self.find_ele(loc)
        return ele
    # 第三步
    def suo(self):
        print('点击搜索按钮')
        loc = (By.ID,'com.kongfz.app:id/tvSearch')
        ele = self.find_ele(loc)
        return ele
    # 第四步
    def ming(self):
        print('点击书名')
        loc = (By.XPATH,'(//android.widget.TextView[@resource-id="com.kongfz.app:id/tvName"])[13]')
        ele = self.find_ele(loc)
        return ele
    # 第五步
    def jia(self):
        print('点击加入购物车')
        loc = (By.ID,'com.kongfz.app:id/tvAddCart1')
        ele = self.find_ele(loc)
        return ele
    # 第六步
    def fan1(self):
        print('点击返回')
        loc = (By.ANDROID_UIAUTOMATOR,'new UiSelector().className("android.view.View").instance(7)')
        ele = self.find_ele(loc)
        return ele
    # 第七步
    def fan2(self):
        print('再次点击返回')
        loc = (By.ID,'com.kongfz.app:id/iv_back')
        ele = self.find_ele(loc)
        return ele
    # 第八步
    def qiao1(self):
        print('轻敲购物车')
        self.qiao(762,1814)
    def duan1(self):
        print('断言全部')
        loc = (By.ID,'com.kongfz.app:id/tv_char_all')
        ele = self.find_ele(loc)
        return ele
    def duan2(self):
        print('断言管理')
        loc = (By.ID,'com.kongfz.app:id/tv_manage')
        ele = self.find_ele(loc)
        return ele
